<?php

Yii::import('frontend.modules.user.models._base.BaseProfile');

class Profile extends BaseProfile {

    public static function model($className = __CLASS__) {
        return parent::model($className);
    }

    public $termcondition;

    public function rules() {
        return array(
            array('user_id', 'required'),
            array('termcondition', 'required', 'requiredValue' => 1, 'message' => 'You should accept term to use our service', 'on'=>'updateprofile'),
            array('user_id, timestamp, phone, age, skill_country_id, skill_state_id', 'numerical', 'integerOnly' => true),
            array('privacy', 'length', 'max' => 9),          
            array('first_name, phone, about, experience, other_info','required', 'on'=>'update'),
            array('date_of_birth', 'length', 'max' => 10),
            array('photo, facebook, twitter, linkedin, website_title, website_link, blog_title, blog_link, others, others_link', 'length', 'max' => 45),
            array('facebook,twitter,linkedin,website_link,blog_link,others_link', 'url', 'defaultScheme' => 'http', 'message' => 'Please use http://'),
            array('other_info', 'length', 'max' => 500),
            array('about, experience', 'safe'),
            array('last_name, first_name, phone, age, date_of_birth, photo, about, experience, other_info, skill_country_id, skill_state_id, facebook, twitter, linkedin, website_title, website_link, blog_title, blog_link, others, others_link', 'default', 'setOnEmpty' => true, 'value' => null),
			array('profile_id, user_id, timestamp, privacy, last_name, first_name, phone, age, date_of_birth, photo, about, experience, other_info, skill_country_id, skill_state_id, facebook, twitter, linkedin, website_title, website_link, blog_title, blog_link, others, others_link, cache_last_updated', 'safe'),
            array('profile_id, user_id, timestamp, privacy, last_name, first_name, phone, age, date_of_birth, photo, about, experience, other_info, skill_country_id, skill_state_id, facebook, twitter, linkedin, website_title, website_link, blog_title, blog_link, others, others_link, cache_last_updated', 'safe', 'on' => 'search'),
        );
    }

}